<{include file='public/head'}>
<div class="layui-body">
	<div class="layui-tab layui-tab-brief" lay-filter="tab">
	  <ul class="layui-tab-title">
	    <li class="layui-this"><{$model_name}>内容修改</li>
	  </ul>
	  <div class="layui-tab-content">
	  	<div class="layui-tab-item layui-show">
	  		<form action="<{:url('/Content/mod/id/'.$UrlParam['id'].'')}>" method="post" class="layui-form" id="edit">
	  			<input type="hidden" name="formcheck" value="<{$formcheck}>" >
	  			<div class="layui-tab">
					  <ul class="layui-tab-title">
					    <li class="layui-this">基本内容</li>
					    <li>高级内容</li>
					  </ul>
					  <div class="layui-tab-content">
					    <div class="layui-tab-item layui-show">
					    	<div class="layui-form-item">
			                     <label class="layui-form-label">内容栏目   <span class="layui-text-red">*</span></label>
			                     <div class="layui-input-block">
			                     	<select name="scode" lay-verify="required">
				                        <option value="">请选择内容栏目</option>
			                        	<{$sort_select}>
				                    </select>
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">内容标题   <span class="layui-text-red">*</span></label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="title" required lay-verify="required" value="<{$content.title}>" placeholder="请输入内容标题" class="layui-input">
			                     </div>
			                </div>

							<{volist name=":getwholelist(0,$UrlParam.mcode)" id="li" key='kkk'}>
							<div class="layui-form-item">
								<label class="layui-form-label"><{$li.TypeName}></label>
								<div class="layui-input-block">
									<select name="rund<{$kkk}>">
											<option value="">请选择<{$li.TypeName}></option>
											<{volist name=":getwholelist($li.TypeID,$UrlParam.mcode)" id="li2"}>
											<option value="<{$li2.TypeID}>"<{if condition="$li2.TypeID eq $content['rund'.$kkk]"}> selected <{/if}>><{$li2.TypeName}> </option>
											<{/volist}>
									</select>
								</div>
							 </div>
							 <{/volist}>

							<{volist name="$extfield" id="value"}>
			                	<{if condition="$value->type eq 1"}> <!-- 单行文本 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label"><{$value->description}> <{if condition="$value->isture eq 1"}> <span class="layui-text-red">*</span><{/if}></label>
			                		<div class="layui-input-block">
				                    	<input type="text" name="<{$value->name}>"  placeholder="请输入<{$value->description}>"  class="layui-input" value="<{$content[$value->name]}>">
				                	</div>
				                </div>
			                	<{/if}>
			                	<{if condition="$value->type eq 2"}><!-- 多行文本 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label"><{$value->description}> <{if condition="$value->isture eq 1"}> <span class="layui-text-red">*</span><{/if}></label>
			                		<div class="layui-input-block">
				                		<textarea name="<{$value->name}>" class="layui-textarea" placeholder="请输入<{$value->description}>">
										<{php}>
											$name=$value->name;
											echo str_replace('<br>', "\r\n",$content[$name]);
										<{/php}>
										</textarea>
				                	</div>
				                </div>
			                	<{/if}>
			                    <{if condition="$value->type eq 3"}><!-- 单选 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label"><{$value->description}></label>
			                		<div class="layui-input-block">
				                		<div>
				                			<{php}>
				                				$radios=explode(',',$value->value);
												$name=$value->name;
				                				foreach ($radios as $value2) {
				                					if($content[$name]==$value2){
	                									echo '<input type="radio" name="'.$value->name.'" value="'.$value2.'" title="'.$value2.'" checked>';
	                								}else{
	                									echo '<input type="radio" name="'.$value->name.'" value="'.$value2.'" title="'.$value2.'">';
	                								}
	            								}
	            						     <{/php}>
					                    </div>
				                	</div>
				                </div>
			                	<{/if}>
			                    <{if condition="$value->type eq 4"}><!-- 多选 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label"><{$value->description}></label>
			                		<div class="layui-input-block">
				                		<div>
				                			<{php}>
				                				$checkboxs=explode(',',$value->value);
				                				$name=$value->name;
				                				echo '<input name="'.$value->name.'" type="hidden">';//占位清空
				                				$values=explode(',',$content[$name]);
				                				foreach ($checkboxs as $value2) {
				                					if(in_array($value2,$values)){
	            										echo '<input type="checkbox" name="'.$value->name.'[]" value="'.$value2.'" title="'.$value2.'" checked>';
	            									}else{
	            										echo '<input type="checkbox" name="'.$value->name.'[]" value="'.$value2.'" title="'.$value2.'">';
	            									}
	            								}
	            						    <{/php}>
					                    </div>
				                	</div>
				                </div>
			                	<{/if}>
			                	<{if condition="$value->type eq 5"}><!-- 图片 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label"><{$value->description}></label>
			                		<div class="layui-input-inline">
				                     	<input type="text" name="<{$value->name}>" id="<{$value->name}>" placeholder="请上传<{$value->description}>"  class="layui-input">
				                     </div>
				                     <button type="button" class="layui-btn upload watermark" data-des="<{$value->name}>">
									 	 <i class="layui-icon">&#xe67c;</i>上传图片
									 </button>

									  <{php}>$name=$value->name; <{/php}>
									 <div id="<{$value->name}>_box" class="pic"><dl><dt><{if condition="$content[$name]"}><img src='<{$content[$name]}>' data-url="<{$content[$name]}>"></dt><dd>删除</dd></dl><{/if}></div>
				                </div>
			                	<{/if}>
			                	<{if condition="$value->type eq 6"}><!-- 文件 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label"><{$value->description}></label>
			                		<div class="layui-input-inline">
				                     	<input type="text" name="<{$value->name}>" id="<{$value->name}>" placeholder="请上传<{$value->description}>"  class="layui-input" value="<{$content[$value->name]}>">
				                     </div>
				                     <button type="button" class="layui-btn file" data-des="<{$value->name}>">
									 	 <i class="layui-icon">&#xe67c;</i>上传文件
									 </button>
				                </div>
			                	<{/if}>
			                	<{if condition="$value->type eq 8"}><!-- 编辑器 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label"><{$value->description}> <{if condition="$value->isture eq 1"}> <span class="layui-text-red">*</span><{/if}></label>
			                		<div class="layui-input-block">
										<{php}>
			                				$name=@$value->name;
			                			<{/php}>
				                		<script type="text/plain" id="editor_<{$value->name}>" name="<{$value->name}>" style="width:100%;height:240px;"><{:decode_string($content->$name)}></script>
				                		<script>
											//初始化编辑器
											$(document).ready(function (e) {
												var ue = UE.getEditor('editor_<{$value->name}>',{
													maximumWords:10000
												});
											})
										</script>
				                	</div>
				                </div>
			                	<{/if}>
			                	<{if condition="$value->type eq 9"}><!-- 下拉 -->
			                	<div class="layui-form-item">
			                		<label class="layui-form-label"><{$value->description}> <{if condition="$value->isture eq 1"}> <span class="layui-text-red">*</span><{/if}></label>
			                		<div class="layui-input-block">
			                			<select name="<{$value->name}>" <{if condition="$value->isture eq 1"}>lay-verify="required"<{/if}>>
			                				<{php}>
											$selects=explode(',',$value->value);
												echo '<option value="">请选择'.$value->description.'</option>';
				                				$name=$value->name;
				                				foreach ($selects as $value2) {
				                					if($content[$name]==$value2){
				                						echo '<option value="'.$value2.'" selected>'.$value2.'</option>';
	                								}else{
	                									echo '<option value="'.$value2.'">'.$value2.'</option>';
	                								}
	            								}
	            						    <{/php}>
			                			</select>
				                	</div>
				                 </div>
			                	<{/if}>
			                 <{/volist}>






			                <div class="layui-form-item">
			                     <label class="layui-form-label">内容</label>
			                     <div class="layui-input-block">
			                     	<script type="text/plain" id="editor" name="content" style="width:100%;height:240px;"><{:decode_string($content.content)}></script>
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">tags</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="tags" placeholder="请输入文章tag，英文逗号隔开" value="<{$content.tags}>" class="layui-input">
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">作者</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="author" placeholder="请输入作者" value="<{$content.author}>" class="layui-input">
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">来源</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="source" placeholder="请输入来源" value="<{$content.source}>" class="layui-input">
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">缩略图</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="ico" id="ico" value="<{$content.ico}>" placeholder="请上传缩略图"  class="layui-input">
			                     </div>
			                     <button type="button" class="layui-btn upload watermark" data-des="ico">
								 	 <i class="layui-icon">&#xe67c;</i>上传图片
								 </button>
								 <div id="ico_box" class="pic addedit"><{if condition="$content.ico"}><dl><dt><img src="<{$content.ico}>" data-url="<{$content.ico}>"></dt><dd>删除</dd></dl><{/if}></div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">状态</label>
			                     <div class="layui-input-block">
									<input type="checkbox" name="istop" value="1" title="置顶图" <{if condition="$content.istop eq 1"}>checked<{/if}>>
			                    	<input type="checkbox" name="isrecommend" value="1" title="推荐" <{if condition="$content.isrecommend eq 1"}>checked<{/if}>>
			                    	<!--<input type="checkbox" name="isheadline" value="1" title="精选" <{if condition="$content.isheadline eq 1"}>checked<{/if}>>
									<input type="checkbox" name="isslide" value="1" title="幻灯" <{if condition="$content.isslide eq 1"}>checked<{/if}>>--->
			                     </div>
			                </div>
					    </div>
					    <div class="layui-tab-item ">
					    	<!--<div class="layui-form-item">
			                     <label class="layui-form-label">内容副栏目</label>
			                     <div class="layui-input-block">
			                     	<select name="subscode">
				                        <option value="">请选择内容副栏目</option>
			                        	<{$subsort_select}>
				                    </select>
			                     </div>
			                </div>--->
					   		 <div class="layui-form-item">
			                     <label class="layui-form-label">标题颜色</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="titlecolor" value="<{$content.titlecolor}>" placeholder="请选择标题颜色"  class="layui-input jscolor <{hash:true}>">
			                     </div>
			                 </div>
			                 <div class="layui-form-item">
			                     <label class="layui-form-label">副标题</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="subtitle" value="<{$content.subtitle}>" placeholder="请输入副标题" class="layui-input">
			                     </div>
			                 </div>

			                  <div class="layui-form-item">
			                     <label class="layui-form-label">跳转外链接</label>
			                     <div class="layui-input-block">
								 <input type="hidden" name="filename" value="<{$content.filename}>" placeholder="请输入URL名称，如:test" class="layui-input">
			                     	<input type="text" name="outlink" value="<{$content.outlink}>" placeholder="请输入跳转外链接" class="layui-input">
			                     </div>
			                 </div>

			                 <div class="layui-form-item">
			                     <label class="layui-form-label">发布时间</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="date" value="<{$content.date}>" readonly placeholder="请选择发布时间"  class="layui-input datetime">
			                     </div>
			                </div>

			                <div class="layui-form-item">
		                		<label class="layui-form-label">附件</label>
		                		<div class="layui-input-inline">
			                     	<input type="text" name="enclosure" id="enclosure" value="<{$content.enclosure}>" placeholder="请上传附件"  class="layui-input">
			                     </div>
			                     <button type="button" class="layui-btn file" data-des="enclosure">
								 	 <i class="layui-icon">&#xe67c;</i>上传附件
								 </button>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">SEO关键字</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="keywords" value="<{$content.keywords}>"  placeholder="请输入详情页SEO关键字" class="layui-input">
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">SEO描述</label>
			                     <div class="layui-input-block">
			                     	<textarea name="description" placeholder="请输入详情页SEO描述" class="layui-textarea"><{$content.description}></textarea>
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">状态</label>
			                     <div class="layui-input-block">
			                     	<input type="radio" name="status" value="1" title="显示" <{if condition="$content.status eq 1"}> checked="checked"<{/if}>>
									<input type="radio" name="status" value="0" title="隐藏" <{if condition="$content.status eq 0"}> checked="checked"<{/if}>>
			                     </div>
			                </div>
					    </div>
					  </div>
					</div>
					<div class="layui-form-item">
						 <div class="layui-input-block">
						    <button class="layui-btn" lay-submit>立即提交</button>
						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
						    <{:get_btn_back()}>
						 </div>
					</div>
	  		</form>
	  	</div>
	  </div>
	</div>
</div>

<style>.placeHolder {border:dashed 2px gray; }</style>
<script type="text/javascript" src="__STATIC__/tongycjs/js/jquery.dragsort-0.5.2.min.js"></script>
<script type="text/javascript">
$("#pics_box").dragsort({
	dragSelector: "dl",
	dragSelectorExclude: "input,textarea,dd",
	dragBetween: false,
	dragEnd: saveOrder,
	placeHolderTemplate: "<dl class='placeHolder'><dt></dt></dl>"
});

function saveOrder() {
	var data = $("#pics_box dl dt img").map(function() {
		return $(this).data("url");
	}).get();
	$("input[name=pics]").val(data.join(","))
};
</script>
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/jscolor/2.1.0/jscolor.js"></script>
<{include file='public/ueditor'}>
<{include file='public/foot'}>